package com.example.front.service;

import cn.hutool.http.HttpRequest;
import com.example.gok_mall.entity.User;
import com.example.gok_mall.reponseData.ResultData;
import org.springframework.transaction.annotation.Transactional;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;


public interface UserService {
    /**
     * 根据用户名和密码获取用户信息
     * @param userName  用户名
     * @param password 密码
     * @return
     */

    ResultData queryUserByUsernameAndPassword(String userName, String password);
    /**
     * 根据用户名获取用户的密保问题
     * @param userName  用户名
     * @return   密保问题
     */

    ResultData queryUserPasswordQuestion(String userName);
    /**
     * 检查用户的密保问题是否正确
     * @param username
     * @param question
     * @param answer
     * @return
     */

    ResultData checkUserPasswordAnswer(String username, String question ,String answer);
    /**
     * 实现用户数据更新
     * @param user
     * @return
     */

    ResultData updateUser(User user);
    /**
     * 实现用户注册
     * @param user
     * @return
     */

    ResultData addUser(User user);

    //判断是否能够重置密码
    //ServerResponse<String> forgetRestPassword(String username,String passwordNew,String forgetToken);
    //ResultData resetPasswordByToken(User user, HttpServletRequest httpServletRequest);
    ResultData resetPasswordByToken(String username, String password, String forgetToken);

    //判断用户名何邮箱是否有效
    ResultData checkValid(String str,String type);;

    //登录状态下重置密码
    ResultData resetPassword(String passwordOld,String passwordNew,User user);
}
